import keyword
print(keyword.kwlist)
def add(a, b):
    return a + b

def sub(a, b):
    return a - b

def mul(a, b):
    return a * b

def div(a, b):
    if b == 0:
        return "除数不能为0"
    return a / b

"""
计算器：对数字，布尔类型不输出长度直接返回提示
"""
count = 6
while count > 0:
    print("****1、加法****")
    print("****2、减法****")
    print("****3、乘法****")
    print("****4、除法****")
    print("****5、退出****")
    num = int(input("请输入数字选择功能："))
    if num == 5:
        print("退出成功")
        break
    elif num < 1 or num > 5:
        print("输入错误，请重新输入")
        continue
    else:
        try:
            a = float(input("请输入第一个数字："))
            b = float(input("请输入第二个数字："))
        except ValueError:
            print("输入错误，请输入数字")
            continue
        if num == 1:
            print(add(a,b))
        elif num == 2:
            print(sub(a,b))
        elif num == 3:
            print(mul(a,b))
        elif num == 4:
            print(div(a,b))